package com.sensePlusVR.bean;

import java.util.Arrays;
import java.util.List;

import org.xutils.DbManager;
import org.xutils.db.annotation.Column;
import org.xutils.db.annotation.Table;

import android.content.Context;

import com.sensePlusVR.application.VRApplication;
import com.sensePlusVR.base.EntityBase;
import com.sensePlusVR.utils.MyLog;
@Table(name = "BuriePointActiveReqDto")
public class BuriePointActiveReqDto extends EntityBase{
	private static final String TAG = BuriePointActiveReqDto.class.getSimpleName();
	
	@Column(name = "uid")
	private Integer uid;
	
	@Column(name = "uuid")
	private String uuid;
	
	@Column(name = "provider")
	private String provider = "LOVERS";
	
	@Column(name = "last_version")
	private String last_version;
	
	@Column(name = "location")
	private Double[] location;
	
	@Column(name = "visit_num")
	private Integer visit_num;
	
	@Column(name = "interval")
	private Long interval;
	
	@Column(name = "duration")
	private Long duration;
	
	@Column(name = "start_time")
	private String start_time;
	
	@Column(name = "end_time")
	private String end_time;
	
	

	public BuriePointActiveReqDto() {
		super();
	}
	
	public BuriePointActiveReqDto(Integer uid, String provider,
			String last_version, Integer visit_num, Long interval,
			Long duration, String start_time, String end_time) {
		super();
		this.uid = uid;
		this.provider = provider;
		this.last_version = last_version;
		this.visit_num = visit_num;
		this.interval = interval;
		this.duration = duration;
		this.start_time = start_time;
		this.end_time = end_time;
		
	}
	

	public Integer getUid() {
		return uid;
	}

	public void setUid(Integer uid) {
		this.uid = uid;
	}

	public String getUuid() {
		return uuid;
	}

	public void setUuid(String uuid) {
		this.uuid = uuid;
	}

	public String getProvider() {
		return provider;
	}

	public void setProvider(String provider) {
		this.provider = provider;
	}

	public String getLast_version() {
		return last_version;
	}

	public void setLast_version(String last_version) {
		this.last_version = last_version;
	}

	public Double[] getLocation() {
		return location;
	}

	public void setLocation(Double[] location) {
		this.location = location;
	}

	public Integer getVisit_num() {
		return visit_num;
	}

	public void setVisit_num(Integer visit_num) {
		this.visit_num = visit_num;
	}

	public Long getInterval() {
		return interval;
	}

	public void setInterval(Long interval) {
		this.interval = interval;
	}

	public Long getDuration() {
		return duration;
	}

	public void setDuration(Long duration) {
		this.duration = duration;
	}

	public String getStart_time() {
		return start_time;
	}

	public void setStart_time(String start_time) {
		this.start_time = start_time;
	}

	public String getEnd_time() {
		return end_time;
	}

	public void setEnd_time(String end_time) {
		this.end_time = end_time;
	}

	@Override
	public String toString() {
		return "BuriePointActiveReqDto [uid=" + uid + ", uuid=" + uuid
				+ ", provider=" + provider + ", last_version=" + last_version
				+ ", location=" + Arrays.toString(location) + ", visit_num="
				+ visit_num + ", interval=" + interval + ", duration="
				+ duration + ", start_time=" + start_time + ", end_time="
				+ end_time + "]";
	}
	
	
	
	public static void saveOrUpdate(Object object) {
		try {
			Context context = VRApplication.getAppContext();
			if (context != null) {
				DbManager db = VRApplication.getDbManager();
				db.saveOrUpdate(object);
			}
		} catch (Exception e) {
			MyLog.e(TAG, "saveOrUpdate failed: " + e);
		}
	}
	
	public static List<BuriePointActiveReqDto> getAllBuriePointActiveReqDto(){
		try {
			Context context = VRApplication.getAppContext();
			if (context != null) {
				DbManager db = VRApplication.getDbManager();
				return db.findAll(BuriePointActiveReqDto.class);
			}
		} catch (Exception e) {
			MyLog.e(TAG, "getAllBuriePointActiveReqDto failed: " + e);
			return null;
		}
		return null;
	}
	
	public static void delAllData(){
		try {
			Context context = VRApplication.getAppContext();
			if (context != null) {
				DbManager db = VRApplication.getDbManager();
				db.delete(BuriePointActiveReqDto.class);
			}
		} catch (Exception e) {
			MyLog.e(TAG, "delAllData failed: " + e);
		}
		
	}
	
}
